package cn.echoedu.control;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import cn.echoedu.command.base.SuccessParam;
import cn.echoedu.entity.Student;
import cn.echoedu.entity.receivecommand.QuerySchoolInfoByUserNumberReceive;
import cn.echoedu.entity.receivecommand.StudentListReceive;
import cn.echoedu.model.StudentModel;
import cn.echoedu.util.WebContext;

public class StudentControl extends BaseControl{
     
	 
	public void queryStudentListByClassCode(HttpServletRequest request,
			HttpServletResponse response,
			StudentListReceive studentlistreceive) {
		// TODO Auto-generated method stub
		List<Student> studentlist = getStudentModel().queryStudentListByClassCode(
				studentlistreceive.getClasscode());
		sendSuccess(getSuccessParam(request, response,studentlist,studentlistreceive.getToken(),
				studentlistreceive.getCode()));
	}
	public void doQuerySchoolInfoByUserNumber(
			HttpServletRequest request,
			HttpServletResponse response,
			QuerySchoolInfoByUserNumberReceive queryschoolinforeceive) {
		// TODO Auto-generated method stub
		List<Student> studentlist = getStudentModel().querySchoolInfoByUserNumber(queryschoolinforeceive.getUser_number());
	    if(studentlist!=null&&studentlist.get(0)!=null){
	    	sendSchoolInfo(getSuccessParam(request, response, studentlist.get(0),
	    			queryschoolinforeceive.getToken(),
	    			queryschoolinforeceive.getCode()));
	    }
	}
	private void sendSuccess(SuccessParam successparam){
		getResponseService().doQueryStudentListSuccess(successparam);
	}
	private void sendSchoolInfo(SuccessParam succesparam){
		getResponseService().doSchoolInfo(succesparam);
		
	}

}
